<?php
	defined("AT_EXE") or die ("CORE VARIABLE IS NOT DEFINED.");
	class CategoryController extends Controller {
		public function __construct(){
			$this->calledClass(get_class($this));
		}
		/*
		 * function index is function to display all records to user
		 * and function search is binding in this function also
		 */
		public function getCategories($id){
			$this->open(Model::MYSQL);
			$result=parent::query("select id,name,parent_id from Categories where parent_id=$id");
			$datas = array();
			while(($row=mysql_fetch_object($result))){
				$datas[] = $row ;
			}
			return isset($datas)?$datas:"";
		}
		public function index(){
			 // $var1 = "I am variable 1" ;
			$this->set(array("var1"=>"I am variable 1"));
			 // $var2 = "I am variable 2" ;
			$this->set(array("var2"=>"I am variable 2"));
			// echo $var1 ;
			//echo "VARIABLE 1 : " . $this->get("var1") . "<br/>" ;
			// echo $var2 ;
			//echo "VARIABLE 2 : "  . $this->get("var2") . "<br/>" ;
			// get variable from get [url]
			//echo "Name : " . $this->get("name") . "<br/>" ;
			//echo " Yes, you have called me  !!!" ;
			
			//$objArticle = $this->loadModel("Article");
			//$articles = $objArticle->show();
			//$this->set(array("articles"=>$articles)); 
			//$this->render("layout");
			
		}
		/*
		 * function add() works as two function :
		 * 1. display add interface to user
		 * 2. add user information to database
		 */
		public function add(){}
		/*
		 * function add() works as two function :
		 * 1. display edit interface to user
		 * 2. edit user information to database
		 */
		public function edit(){}
		/*
		 * function delete is function to delete a record or many
		 * records from database
		 */
		public function delete(){}
	}